package cn.edu.uestc.cwdsj.service;

import cn.edu.uestc.cwdsj.dao.IPzdDao;
import cn.edu.uestc.cwdsj.domain.Pzd;
import cn.edu.uestc.cwdsj.utils.constant.RoleConstants;
import cn.edu.uestc.framework.auth.annotation.TKRoleRequired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
@Transactional
public class Testfeirenyuanzhichu {
    @Resource
    private IPzdDao pzdDao;

    @TKRoleRequired(roleId = RoleConstants.ROLE_ANY)
    public List<Feirenyuanzhichu> getfeirenList() {
        List<Pzd> tempList = new ArrayList<Pzd>(pzdDao.getList());
        List<Feirenyuanzhichu> result = new ArrayList<Feirenyuanzhichu>();
        for (Pzd i : tempList) {
            String subj = i.getSubj();
            subj += ".1.1";
            String[] Array = subj.split("\\.");
            if ((Array[0].indexOf("500") != -1) && (((Integer.parseInt(Array[1]) >= 201) && (Integer.parseInt(Array[1]) <= 218)) || ((Integer.parseInt(Array[1]) >= 224) && (Integer.parseInt(Array[1]) <= 230)) || (Integer.parseInt(Array[1]) == 299) || ((Integer.parseInt(Array[1]) >= 901) && (Integer.parseInt(Array[1]) <= 908)) || (Integer.parseInt(Array[1]) == 913) || (Integer.parseInt(Array[1]) == 919) || (Integer.parseInt(Array[1]) == 999) || ((Integer.parseInt(Array[2]) >= 1001) && (Integer.parseInt(Array[2]) <= 1013)) || ((Integer.parseInt(Array[2]) >= 1019) && (Integer.parseInt(Array[2]) <= 1020)) || (Integer.parseInt(Array[2]) == 1099))) {
                if (i.getdAmount() >= 5000000) {
                    Feirenyuanzhichu temp = new Feirenyuanzhichu();
                    temp.setAcnt(i.getAcnt());
                    temp.setBankno(i.getBankno());
                    temp.setChargeNam(i.getChargeNam());
                    temp.setChargeSno(i.getChargeSno());
                    temp.setCheckName(i.getCheckName());
                    temp.setDamount(i.getdAmount());
                    temp.setSabstract(i.getSabstract());
                    temp.setInputName(i.getInputName());
                    temp.setJsfsCode(i.getJsfsCode());
                    temp.setJamount(i.getjAmount());
                    temp.setSubj(i.getSubj());
                    temp.setOtherunit(i.getOtherUnit());
                    temp.setPrjName(i.getPrjName());
                    temp.setPrjOrder(i.getPrjOrder());
                    temp.setSday(i.getSday());
                    temp.setSmonth(i.getSmonth());
                    temp.setSyear(i.getSyear());
                    temp.setTaxNo(i.getTaxNo());
                    temp.setSubjname(i.getSubjname());
                    temp.setUniNo(i.getUniNo());
                    temp.setZph(i.getZph());
                    result.add(temp);
                }
            }
        }
        return result;
    }
}
